From: Leleat Date: Fri, 7 May 2021 11:26:21 +0000 (+0200) Subject: switcherPopups: Correct selection with arrows and scrolling using RTL X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5423179844bc5c4b30603323c6be2ae3c7c46e57;p=gnome-shell.git switcherPopups: Correct selection with arrows and scrolling using RTL The switcherPopups use _next() and _previous() to get the items in the text direction. I. e. with LTR _next() gets the right item; on RTL it gets the left item. This doesn't work well with RTL when using the arrow keys since the text direction doesn't matter in those cases. Pressing Left Arrow should still move left regardless of text direction. So use the opposite methods. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2547 Part-of: --- diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 2ae7b6b23..bc8b17fac 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -164,6 +164,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { } _keyPressHandler(keysym, action) { + const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; if (action == Meta.KeyBindingAction.SWITCH_GROUP) { if (!this._thumbnailsFocused) this._select(this._selectedIndex, 0); @@ -179,9 +180,9 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { this._quitApplication(this._selectedIndex); } else if (this._thumbnailsFocused) { if (keysym === Clutter.KEY_Left) - this._select(this._selectedIndex, this._previousWindow()); + this._select(this._selectedIndex, rtl ? this._nextWindow() : this._previousWindow()); else if (keysym === Clutter.KEY_Right) - this._select(this._selectedIndex, this._nextWindow()); + this._select(this._selectedIndex, rtl ? this._previousWindow() : this._nextWindow()); else if (keysym === Clutter.KEY_Up) this._select(this._selectedIndex, null, true); else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_W || keysym === Clutter.KEY_F4) @@ -189,9 +190,9 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { else return Clutter.EVENT_PROPAGATE; } else if (keysym == Clutter.KEY_Left) { - this._select(this._previous()); + this._select(rtl ? this._next() : this._previous()); } else if (keysym == Clutter.KEY_Right) { - this._select(this._next()); + this._select(rtl ? this._previous() : this._next()); } else if (keysym == Clutter.KEY_Down) { this._select(this._selectedIndex, 0); } else { @@ -589,14 +590,15 @@ class WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup { } _keyPressHandler(keysym, action) { + const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) this._select(this._next()); else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) this._select(this._previous()); else if (keysym == Clutter.KEY_Left) - this._select(this._previous()); + this._select(rtl ? this._next() : this._previous()); else if (keysym == Clutter.KEY_Right) - this._select(this._next()); + this._select(rtl ? this._previous() : this._next()); else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_W || keysym === Clutter.KEY_F4) this._closeWindow(this._selectedIndex); else